{ Notes

This file provides some useful tools to be used in the IDE.

words:
  EXPLORE
  $CD
  RUN - load a file using REQUIRES and remember both the filename and the directory it was loaded from. RUN typed alone reloads the file.
  LISTWORDS
  RUN$ and RUN-PATH$ may have strings PLACE'd into them any time.

This gets gilded to the dictionary.

}

only forth definitions

: (explore)   ( path& len -- )
   s" explorer " pad place ( path& len ) pad append pad count >shell ;

: explore   ( -- <path> )
   0 parse dup 0= if 2drop s" . " then (explore) ;

: $cd ( path& len -- )
   pad zplace pad SetCurrentDirectory 0= abort" invalid directory" ;

create run$ 64 allot  s" requires forthquest\Quest-dev" run$ place
create run-path$ 256 allot   pad 256 over GetCurrentDirectory 2dup type run-path$ place

-? : run
  0 parse ?dup if
\    pad 256 over GetCurrentDirectory run-path$ place
    s" requires " run$ place run$ append else
  drop then
  run-path$ count $cd
  run$ count evaluate ;

package name-tools
: .name-cr
   dup body> >name count pad place
   pad count 2dup upcase s" GL" search if 2drop drop exit then
   2drop
   dup .name
   name> false word-location -path get-xy nip 40 swap at-xy type drop cr ;
public
: listwords  #WORDS OFF
   FILTERED  CONTEXT @
   ['] .name-cr .wid-words ;
end-package

gild
